<% title _("Operating Systems") %>
<% title_actions new_link(_("Create Operating System")),
                 documentation_button('4.4.1OperatingSystems') %>

<table class="<%= table_css_classes 'table-fixed' %>">
  <thead>
    <tr>
      <th class="col-md-8"><%= sort :title, :as => s_("Operatingsystem|Title") %></th>
      <th><%= _("Hosts") %></th>
      <th><%= _('Actions') %></th>
    </tr>
  </thead>
  <tbody>
    <% @operatingsystems.each do |operatingsystem| %>
      <%
        edit_btn = display_link_if_authorized(_("Edit"), hash_for_edit_operatingsystem_path(id: operatingsystem).merge(auth_object: operatingsystem, authorizer: authorizer))
        clone_btn = display_link_if_authorized(_("Clone"), hash_for_clone_operatingsystem_path(id: operatingsystem).merge(auth_object: operatingsystem, authorizer: authorizer, permission: 'create_operatingsystems'))
        delete_btn = display_delete_if_authorized(hash_for_operatingsystem_path(id: operatingsystem).merge(auth_object: operatingsystem, authorizer: authorizer), data: { confirm: _("Delete %s?") % operatingsystem.fullname }, class: 'delete')
      %>
      <tr>
        <td class="ellipsis"><%= link_to_if_authorized(os_name(operatingsystem), hash_for_edit_operatingsystem_path(:id => operatingsystem).merge(:auth_object => operatingsystem, :authorizer => authorizer)) %></td>
        <td><%= link_to hosts_count[operatingsystem], current_hosts_path(:search => "os_id = #{operatingsystem.id}") %></td>
        <td>
          <%= action_buttons(edit_btn, clone_btn, delete_btn) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= will_paginate_with_info @operatingsystems %>
